package com.rocket.consumer.controller;

import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Description:
 * @ClassName: Consumer
 * @Author: mobiusband
 * @Date:2022/11/16 21:24
 * @Version: 1.0
 */
//监听mytopic，实现简单消息传送
@RocketMQMessageListener(topic = "mytopic", consumerGroup = "my-consumer-group")
public class Consumer implements RocketMQListener<String> {

    @Override
    public void onMessage(String s) {
//        获取消息，并在控制台打印（生产者一有消息就接收了）
        System.out.println("@@@@@接收信息："+s);
    }

}
